import store from '@/store'
import footerConfig from '@/config/site/pagefooter'

export const showFooterHook = (to, from, next) => {
  // console.log(to)
  let { path } = to

  // store.commit('setIsShowFooter', ['/films/nowPlaying', '/films/comingSoon', '/center', '/news', '/cinemas'].includes(path))

  // console.log(path)

  /* store.commit(
    'setIsShowFooter',
    ['/films', '/center', '/news', '/cinemas'].some(item => new RegExp(item).test(path))
  ) */

  store.commit(
    'setIsShowFooter',
    footerConfig.map(({ to }) => to).some(item => new RegExp(item).test(path))
  )

  next()
}
